using System.Data;
using ET;
namespace DAL
{
    public class Proposed_Export_DAL
    {
        private static readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Proposed_Export(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Proposed_Export_SelectAll");
        }
        public DataTable BindGirdtb_Proposed_Export_Materials_Still()
        {
            cls.CreateNewSqlCommand();
            return cls.GetData("sp_tb_Proposed_Export_GetMaterials_Still");
        }
        public DataTable BindGirdtb_Proposed_ExportDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_Export_ID", id);
            return cls.GetData("sp_tb_Proposed_Export_SelectRow");
        }
        public DataTable FilterDate_Proposed_Export(string a, string b)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@DateBegin", a);
            cls.AddParameter("@EndBegin", b);
            return cls.GetData("sp_tb_Proposed_Export_FilterDate");
        }
        public DataTable FilterActive_Proposed_Export(string a)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@IsActive", a);
            return cls.GetData("sp_tb_Proposed_Export_FilterActive");
        }
        public DataTable GetMaterialsFromSell()
        {
            cls.CreateNewSqlCommand();
            return cls.GetData("sp_tb_Sell_GetMaterials");
        }
        public DataTable GetMaterialsFromSellWithCondition(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@ID_Sell", id);
            return cls.GetData("sp_tb_Sell_GetMaterialsCondition");
        }
        #endregion

        #region Insert
        public bool Inserttb_Proposed_Export(Proposed_Export_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_Export_No", data.Proposed_Export_No);
            cls.AddParameter("@Proposed_Export_TaxCode", data.Proposed_Export_TaxCode);
            cls.AddParameter("@Customer_ID", data.Customer_ID);
            cls.AddParameter("@Order_Sell", data.Order_Sell);
            cls.AddParameter("@Proposed_Export_DateBegin", data.Proposed_Export_DateBegin);
            cls.AddParameter("@IsActive", data.IsActive);
            cls.AddParameter("@IsUsed", data.IsUsed);
            cls.AddParameter("@Users_Id", data.Users_Id);
            cls.AddParameter("@Users_Id_Respone", data.Users_Id_Respone);
            cls.AddParameter("@Proposed_Export_Descripttion", data.Proposed_Export_Descripttion);
            data.Proposed_Export_ID = cls.ExecuteNonQueryReturnResult("sp_tb_Proposed_Export_Insert", "@ReferenceID");
            return true;
        }
        #endregion

        #region Update
        public bool Updatetb_Proposed_Export(Proposed_Export_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_Export_ID", data.Proposed_Export_ID);
            cls.AddParameter("@Proposed_Export_No", data.Proposed_Export_No);
            cls.AddParameter("@Proposed_Export_TaxCode", data.Proposed_Export_TaxCode);
            cls.AddParameter("@Customer_ID", data.Customer_ID);
            cls.AddParameter("@Order_Sell", data.Order_Sell);
            cls.AddParameter("@Proposed_Export_DateBegin", data.Proposed_Export_DateBegin);
            cls.AddParameter("@IsActive", data.IsActive);
            cls.AddParameter("@IsUsed", data.IsUsed);
            cls.AddParameter("@Users_Id", data.Users_Id);
            cls.AddParameter("@Users_Id_Respone", data.Users_Id_Respone);
            cls.AddParameter("@Proposed_Export_Descripttion", data.Proposed_Export_Descripttion);
            return cls.ExecuteNonQuery("sp_tb_Proposed_Export_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Proposed_Export(Proposed_Export_ET obj)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_Export_ID", obj.Proposed_Export_ID);
            obj.Msg = cls.ExecuteNonQueryOutput("sp_tb_Proposed_Export_DeleteRow", "@Msg");
            return true;
        }
        #endregion

        #region [Review]
        public bool Review(Proposed_Export_ET obj)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_Export_ID", obj.Proposed_Export_ID);
            cls.AddParameter("@Users_ID_Review", obj.Users_Id_Respone);
            cls.AddParameter("@IsActive", obj.IsActive);
            obj.Msg = cls.ExecuteNonQueryOutput("sp_tb_Proposed_Export_Review", "@Msg");
            return true;
        }
        public bool UnReview(Proposed_Export_ET obj)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Proposed_Export_ID", obj.Proposed_Export_ID);
            cls.AddParameter("@Users_ID_Review", obj.Users_Id_Respone);
            cls.AddParameter("@IsActive", obj.IsActive);
            obj.Msg = cls.ExecuteNonQueryOutput("sp_tb_Proposed_Export_UnReview", "@Msg");
            return true;
        }
        #endregion
    }
}